<?php
// Quy trinh xu ly
/*
    1. Nhan Mo va Luu Mo
    2. Gui Mo sang Mecorp
    3. 
*/          date_default_timezone_set("Asia/Saigon");
            $client = new SoapClient("http://sms.gateway.gomobi.vn:7777/sms/mo?WSDL");
           
            $data = array();
            $name = "vintelcom";
            $accountName = "vintelcom";
            $requestId = time();
            $telco = "viettel"; 
            $serviceNumber = "8055"; 
            $phone = "84974838181";      
            $syntax = "MTPME1";     
            $mesage =    "MTPME1 NAP 488943";
            $dateIime =date('Y-m-d H:i:s');
            $privateKey= "wIOsFEeLoNc6mOf";    
                                                             
            $data["Name"] =$name;
            $data["AccountName"] = $accountName;            
            $data["MOId"] = $requestId; 
            $data["Telco"] = $telco;
            $data["ServiceNum"] =$serviceNumber; 
            $data["Phone"] =$phone;                      
            $data["Syntax"] =$syntax;                      
            $data["Message"] =$mesage;                      
            $data["DateTime"] =$dateIime;
            echo $dateIime."<br/>";

            //MD5(Name+ AccountName+ RequestId+Telco+ ServiceNum+ Phone+Syntax+Message+DateTime+PrivateKey)
            $token = base64_encode(md5($name.$accountName.$requestId.$telco.$serviceNumber.$phone.$syntax.$mesage.$dateIime.$privateKey,0)) ;                 echo      $token."<br/>";
            $token = MD5($name.$accountName.$requestId.$telco.$serviceNumber.$phone.$syntax.$mesage.$dateIime.$privateKey) ;                 echo      $token."<br/>";
                                        
            $data["Token"] =$token;                                           
            
            var_dump($client->__call("SendMO", $data));        
?>
